<script type="text/javascript">
function validate(){
	stoneType = jQuery("#stoneType").val();
	color = jQuery("#color").val();
	region = jQuery("#region").val();
	
	if(stoneType=="" && color=="" && region==""){
		alert("Please select at least one criteria");
		 return false;
	}
	
	return true;
}
</script>

<div id="text-2" class="widget_text widget">
<h3 class="widget-title">Advance Search</h3>
<div class="textwidget">

<form action="http://stoneselector.com/search-result/" method="post">
<ul class="select-dropdown">
	<?php
    $args=array("parent"		=> 42,
                "hide_empty"	=> 0);
    $stoneTypes = get_categories($args); 
    ?>

	<li>
	    <span class="select" id="select1">Stone Type</span>
        <select name="stoneType" class="styled" id="stoneType">
        	<option value="">Select Stone Type</option>
			<?php 
				foreach($stoneTypes as $category):
				if($category->cat_ID == $_POST['stoneType']) $sel='selected="selected"'; else $sel="";
			 ?>
            <option value="<?php echo $category->cat_ID ?>" <?php echo $sel ?>><?php echo $category->name ?></option>
            <?php endforeach; ?>
		</select>
    </li>
    
	<?php
    $args=array("parent"		=> 41,
                "hide_empty"	=> 0);
    $colors = get_categories($args); 
    ?>
    
	<li>
	    <span class="select" id="select2">Colour</span>
        <select name="color" class="styled" id="color">
        <option value="">Select Colour</option>
			<?php 
				foreach($colors as $category):
				if($category->cat_ID == $_POST['color']) $sel='selected="selected"'; else $sel="";
			 ?>
            <option value="<?php echo $category->cat_ID ?>" <?php echo $sel ?>><?php echo $category->name ?></option>
            <?php endforeach; ?>
		</select>
    </li>
    
    
<!--	<li>
	    <span class="select" id="select3">one</span><select name="3" class="styled">
		  	<option value="">one</option>
		  	<option value="">two</option>
		 	<option value="">three</option>
		  	<option value="">four</option>
		 	<option value="">five</option>
		</select>
    </li>
-->    

	<?php
    $args=array("parent"		=> 33,
                "hide_empty"	=> 0);
    $colors = get_categories($args); 
    ?>
    
	<li>
	    <span class="select" id="select4">Region</span>
        <select name="region" class="styled" id="region">
	        <option value="">Select Region</option>
			<?php 
				foreach($colors as $category):
				if($category->cat_ID == $_POST['region']) $sel='selected="selected"'; else $sel="";
			 ?>
            <option value="<?php echo $category->cat_ID ?>" <?php echo $sel ?>><?php echo $category->name ?></option>
            <?php endforeach; ?>
		</select>
    </li>
</ul>
	<input type="submit" value="Search" onclick="return validate()" />
</form>    
</div>
		</div>